<!-- 已录入 -->
<template>
  <div class="box">
    <section class="section_wrap">
      <div class="title_sub prduct_bod_r">产品说明：</div>
      <ProductDescription></ProductDescription>
    </section>

    <section class="section_wrap">
      <div class="title_sub infro_bod_l">信息查看：</div>
      <div class="state">状态：{{ orderStatusName }}</div>
      <EnterInfor></EnterInfor>
    </section>

    <section class="section_three">
      <div class="title_sub upload_bod_l">附件管理：</div>
      <Upload class="uploadStyle" ref="Uploade" :isNew="isNew"></Upload>
    </section>
    <section class="section_wrap" v-if="orderStatus == 0">
      <el-button type="primary" class="primaryButton" @click="primaryButton"
        >提交审批</el-button
      >
    </section>
  </div>
</template>

<script>
import { putOrderCommit, getOrderOne } from "../../../src/assets/js/api";
import EnterInfor from "../../components/fapai/EnterInfor";
import Upload from "../../components/fapai/Upload";
import ProductDescription from "../../components/business/ProductDescriptionToo";

export default {
  data() {
    return {
      isNew: false,
      orderNumber: "",
      ProductUrl: "",
      orderStatusName: "",
      orderStatus: ""
    };
  },
  components: {
    ProductDescription,
    EnterInfor,
    Upload
  },
  created() {
    this.orderNumber = sessionStorage.getItem("orderNumber");
  },
  mounted() {
    this.getOrderOne();
  },
  methods: {
    // 获取本条信息
    getOrderOne() {
      getOrderOne(this.orderNumber).then(res => {
        this.orderStatusName = res.data.orderStatusName;
        this.orderStatus = res.data.orderStatus;
      });
    },
    //提交审批按钮
    primaryButton() {
      //验证审批的身份证图片
      let uploadImg = this.$refs.Uploade.fileList;
      if (!uploadImg.length >= 1) {
        this.$message({
          message: "请上传身份证件照",
          type: "error"
        });
      } else {
        putOrderCommit(this.orderNumber).then(res => {
          if (res.code == 200) {
            this.$message({
              message: res.message,
              type: "success"
            });
            this.$router.go(-1);
            // this.getOrderOne();
          } else {
            this.$message({
              message: res.message,
              type: "error"
            });
          }
          // this.$router.replace({ path: this.ProductUrl });
        });
      }
    }
  }
};
</script>
<style lang="less" scoped>
.state {
  font-size: 22px;
  font-weight: bold;
  float: right;
  margin-top: -30px;
  margin-right: 3%;
}
</style>
